package com.xc.controller;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.xc.model.Students;
import com.xc.service.StudentsService;

@Controller
@RequestMapping(value="/login")
public class LoginController {
	
	@Resource
	private StudentsService studentsService;
	
	@RequestMapping(value="index")
	@ResponseBody
	public int index(Students students,HttpSession session) {
		int flag = studentsService.login(students);
		if(flag == 0) session.setAttribute("students", students);
		return flag;
	}

}


